<template>
  <div class="sendOut bg-gray100 dis-flex flex-sbc">
    <div class="flex-atLeft">
      <el-checkbox v-model="isTiming">定时发送</el-checkbox>
      <el-date-picker v-show="isTiming" size="small"
        v-model="ymd" type="date" format="yyyy-MM-dd"
        :editable="false" :clearable="false"
        placeholder="选择日期">
      </el-date-picker>
      <el-time-picker v-show="isTiming" size="small"
        v-model="hms" value-format="HH:mm"
        :editable="false" :clearable="false"
        :picker-options="hmsPickerOptions"
        placeholder="选择时间点">
      </el-time-picker>
    </div>
    <div class="flex-atRight">
      <el-button type="" @click="readySend">发送</el-button>
    </div>
  </div><!-- sendOut -->
</template>

<script>
export default {
  components:{},
  computed:{},
  data(){
    return {
      isDev:process.env.NODE_ENV== 'development',
      isTiming:false,//是否定时发送
      setTime:(()=>{
        return this.$moment().format('YYYY-M-D')
      })(),
      ymd:'',ymdPickerOptions:{},
      hms:'',hmsPickerOptions:{},
    }
  },
  methods:{
    readySend:function(){
      let r = Boolean(this.ymd) ? this.$moment(this.ymd).format('YYYY-M-D') : '';
      let h = this.hms;
      let arg = {
        isTiming:this.isTiming,
        setTime:`${r} ${h}`
      }
      this.$emit('readySend',arg)
    }
  }
}
</script>

<style lang="less" scoped>
@import url('../../assets/config.less');
@import url('../../assets/style.less');

.sendOut{
  flex:0 0 72px;
  padding:0 16px;
  border-bottom: @defBorder;
}
</style>